/*
 * @Description:
 * @Author: chenjiaxin
 * @Date: 2022-09-03 16:01:39
 * @LastEditTime: 2022-09-04 15:09:06
 * @FilePath: \vue-ts-vite\src\router\index.ts
 */
import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";

const routes: RouteRecordRaw[] = [
  {
    path: "/",
    name: "home",
    component: () => import("@/views/home/index.vue"),
  },
  {
    path: "/about",
    name: "about",
    component: () => import("@/views/about/index.vue"),
  },
  {
    path: "/loading",
    name: "loading",
    component: () => import("@/views/loading/index.vue"),
    meta: {
      keepAlive: true,
    },
  },
  {
    path: "/drawer",
    name: "drawer",
    component: () => import("@/views/drawer/index.vue"),
    meta: {
      keepAlive: true,
    },
  },
  {
    path: "/model",
    name: "model",
    component: () => import("@/views/model/index"),
  },
  {
    path: "/render",
    name: "render",
    component: () => import("@/views/render-function/index.vue"),
  },
  {
    path: "/form",
    name: "form",
    component: () => import("@/views/form/index.vue"),
  },
  {
    path: "/hook",
    name: "hook",
    component: () => import("@/views/custom-hook/index.vue"),
  },
];

const router = createRouter({
  // 4. 内部提供了 history 模式的实现。为了简单起见，我们在这里使用 hash 模式。
  history: createWebHashHistory(),
  routes,
});

export default router;
